package cn.ibizlab.odoo.core.odoo_account.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iaccount_chart_template;
import cn.ibizlab.odoo.core.odoo_account.domain.Account_chart_template;
import cn.ibizlab.odoo.core.odoo_account.filter.Account_chart_templateSearchContext;
import cn.ibizlab.odoo.core.odoo_account.service.IAccount_chart_templateService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[科目表模版] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Account_chart_templateServiceImpl implements IAccount_chart_templateService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iaccount_chart_templateClientService account_chart_templateClientService;

    @Override
    public void updateBatch(List<Account_chart_template> account_chart_templates, int batchSize) {

        //account_chart_templateClientService.updateBatch(account_chart_templates,batchSize) ;

    }

    @Override
    public Account_chart_template get(Integer id) {
        Iaccount_chart_template clientModel = account_chart_templateClientService.createModel();
        clientModel.setId(id);
        account_chart_templateClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Account_chart_template get(Account_chart_template account_chart_template) {
        Account_chart_template retaccount_chart_template = this.get(account_chart_template.getId()) ;
    	BeanCopier copier=BeanCopier.create(retaccount_chart_template.getClass(), account_chart_template.getClass(), false);
        copier.copy(retaccount_chart_template, account_chart_template, null);
        return account_chart_template ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iaccount_chart_template clientModel = account_chart_templateClientService.createModel();
        clientModel.setId(id);
        account_chart_templateClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public boolean update(Account_chart_template account_chart_template) {
        boolean bOk = false ;
        Iaccount_chart_template clientModel = this.convert2Model(account_chart_template,null);
        account_chart_templateClientService.update(clientModel) ;
        this.convert2Domain(clientModel,account_chart_template) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //account_chart_templateClientService.removeBatch(account_chart_templates) ;

    }

    @Override
    public void createBatch(List<Account_chart_template> account_chart_templates, int batchSize) {

                        //account_chart_templateClientService.createBatch(account_chart_templates,batchSize) ;

    }

    @Override
    public boolean create(Account_chart_template account_chart_template) {
        boolean bOk = false ;
        Iaccount_chart_template clientModel = this.convert2Model(account_chart_template,null);
        account_chart_templateClientService.create(clientModel) ;
        this.convert2Domain(clientModel,account_chart_template);
        bOk = true ;

        return bOk ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Account_chart_template> searchDefault(Account_chart_templateSearchContext context) {
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_expense_currency_exchange_account(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_income_currency_exchange_account(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_expense_categ(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_expense(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_income_categ(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_income(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_payable(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_account_receivable(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_stock_account_input_categ(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_stock_account_output_categ(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目模板查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_property_stock_valuation_account(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目表模版查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_parent(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据币种查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_currency(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_create(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_chart_template> selectByOdoo_write(Integer id){
        Account_chart_templateSearchContext context = new Account_chart_templateSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_chart_template> list = new ArrayList<Account_chart_template>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_chart_template> clientModelList = account_chart_templateClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_chart_template clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_chart_template>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iaccount_chart_template convert2Model(Account_chart_template domain , Iaccount_chart_template model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = account_chart_templateClientService.createModel() ;
        }

         if(domain.getCode_digitsDirtyFlag())
            model.setCode_digits(domain.getCode_digits());
         if(domain.getTransfer_account_code_prefixDirtyFlag())
            model.setTransfer_account_code_prefix(domain.getTransfer_account_code_prefix());
         if(domain.getBank_account_code_prefixDirtyFlag())
            model.setBank_account_code_prefix(domain.getBank_account_code_prefix());
         if(domain.getSpoken_languagesDirtyFlag())
            model.setSpoken_languages(domain.getSpoken_languages());
         if(domain.getTax_template_idsDirtyFlag())
            model.setTax_template_ids(domain.getTax_template_ids());
         if(domain.getVisibleDirtyFlag())
            model.setVisible(domain.getVisible());
         if(domain.getAccount_idsDirtyFlag())
            model.setAccount_ids(domain.getAccount_ids());
         if(domain.getComplete_tax_setDirtyFlag())
            model.setComplete_tax_set(domain.getComplete_tax_set());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getCash_account_code_prefixDirtyFlag())
            model.setCash_account_code_prefix(domain.getCash_account_code_prefix());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getUse_anglo_saxonDirtyFlag())
            model.setUse_anglo_saxon(domain.getUse_anglo_saxon());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getExpense_currency_exchange_account_id_textDirtyFlag())
            model.setExpense_currency_exchange_account_id_text(domain.getExpense_currency_exchange_account_id_text());
         if(domain.getProperty_account_receivable_id_textDirtyFlag())
            model.setProperty_account_receivable_id_text(domain.getProperty_account_receivable_id_text());
         if(domain.getCurrency_id_textDirtyFlag())
            model.setCurrency_id_text(domain.getCurrency_id_text());
         if(domain.getProperty_account_expense_id_textDirtyFlag())
            model.setProperty_account_expense_id_text(domain.getProperty_account_expense_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getParent_id_textDirtyFlag())
            model.setParent_id_text(domain.getParent_id_text());
         if(domain.getProperty_stock_account_input_categ_id_textDirtyFlag())
            model.setProperty_stock_account_input_categ_id_text(domain.getProperty_stock_account_input_categ_id_text());
         if(domain.getProperty_account_income_id_textDirtyFlag())
            model.setProperty_account_income_id_text(domain.getProperty_account_income_id_text());
         if(domain.getProperty_account_expense_categ_id_textDirtyFlag())
            model.setProperty_account_expense_categ_id_text(domain.getProperty_account_expense_categ_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getIncome_currency_exchange_account_id_textDirtyFlag())
            model.setIncome_currency_exchange_account_id_text(domain.getIncome_currency_exchange_account_id_text());
         if(domain.getProperty_account_payable_id_textDirtyFlag())
            model.setProperty_account_payable_id_text(domain.getProperty_account_payable_id_text());
         if(domain.getProperty_account_income_categ_id_textDirtyFlag())
            model.setProperty_account_income_categ_id_text(domain.getProperty_account_income_categ_id_text());
         if(domain.getProperty_stock_valuation_account_id_textDirtyFlag())
            model.setProperty_stock_valuation_account_id_text(domain.getProperty_stock_valuation_account_id_text());
         if(domain.getProperty_stock_account_output_categ_id_textDirtyFlag())
            model.setProperty_stock_account_output_categ_id_text(domain.getProperty_stock_account_output_categ_id_text());
         if(domain.getProperty_stock_valuation_account_idDirtyFlag())
            model.setProperty_stock_valuation_account_id(domain.getProperty_stock_valuation_account_id());
         if(domain.getExpense_currency_exchange_account_idDirtyFlag())
            model.setExpense_currency_exchange_account_id(domain.getExpense_currency_exchange_account_id());
         if(domain.getProperty_account_payable_idDirtyFlag())
            model.setProperty_account_payable_id(domain.getProperty_account_payable_id());
         if(domain.getProperty_account_income_categ_idDirtyFlag())
            model.setProperty_account_income_categ_id(domain.getProperty_account_income_categ_id());
         if(domain.getProperty_stock_account_output_categ_idDirtyFlag())
            model.setProperty_stock_account_output_categ_id(domain.getProperty_stock_account_output_categ_id());
         if(domain.getProperty_account_expense_idDirtyFlag())
            model.setProperty_account_expense_id(domain.getProperty_account_expense_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getParent_idDirtyFlag())
            model.setParent_id(domain.getParent_id());
         if(domain.getProperty_account_receivable_idDirtyFlag())
            model.setProperty_account_receivable_id(domain.getProperty_account_receivable_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getProperty_account_expense_categ_idDirtyFlag())
            model.setProperty_account_expense_categ_id(domain.getProperty_account_expense_categ_id());
         if(domain.getIncome_currency_exchange_account_idDirtyFlag())
            model.setIncome_currency_exchange_account_id(domain.getIncome_currency_exchange_account_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getProperty_stock_account_input_categ_idDirtyFlag())
            model.setProperty_stock_account_input_categ_id(domain.getProperty_stock_account_input_categ_id());
         if(domain.getProperty_account_income_idDirtyFlag())
            model.setProperty_account_income_id(domain.getProperty_account_income_id());
        return model ;
    }

    public Account_chart_template convert2Domain( Iaccount_chart_template model ,Account_chart_template domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Account_chart_template();
        }

        if(model.getCode_digitsDirtyFlag())
            domain.setCode_digits(model.getCode_digits());
        if(model.getTransfer_account_code_prefixDirtyFlag())
            domain.setTransfer_account_code_prefix(model.getTransfer_account_code_prefix());
        if(model.getBank_account_code_prefixDirtyFlag())
            domain.setBank_account_code_prefix(model.getBank_account_code_prefix());
        if(model.getSpoken_languagesDirtyFlag())
            domain.setSpoken_languages(model.getSpoken_languages());
        if(model.getTax_template_idsDirtyFlag())
            domain.setTax_template_ids(model.getTax_template_ids());
        if(model.getVisibleDirtyFlag())
            domain.setVisible(model.getVisible());
        if(model.getAccount_idsDirtyFlag())
            domain.setAccount_ids(model.getAccount_ids());
        if(model.getComplete_tax_setDirtyFlag())
            domain.setComplete_tax_set(model.getComplete_tax_set());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getCash_account_code_prefixDirtyFlag())
            domain.setCash_account_code_prefix(model.getCash_account_code_prefix());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getUse_anglo_saxonDirtyFlag())
            domain.setUse_anglo_saxon(model.getUse_anglo_saxon());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getExpense_currency_exchange_account_id_textDirtyFlag())
            domain.setExpense_currency_exchange_account_id_text(model.getExpense_currency_exchange_account_id_text());
        if(model.getProperty_account_receivable_id_textDirtyFlag())
            domain.setProperty_account_receivable_id_text(model.getProperty_account_receivable_id_text());
        if(model.getCurrency_id_textDirtyFlag())
            domain.setCurrency_id_text(model.getCurrency_id_text());
        if(model.getProperty_account_expense_id_textDirtyFlag())
            domain.setProperty_account_expense_id_text(model.getProperty_account_expense_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getParent_id_textDirtyFlag())
            domain.setParent_id_text(model.getParent_id_text());
        if(model.getProperty_stock_account_input_categ_id_textDirtyFlag())
            domain.setProperty_stock_account_input_categ_id_text(model.getProperty_stock_account_input_categ_id_text());
        if(model.getProperty_account_income_id_textDirtyFlag())
            domain.setProperty_account_income_id_text(model.getProperty_account_income_id_text());
        if(model.getProperty_account_expense_categ_id_textDirtyFlag())
            domain.setProperty_account_expense_categ_id_text(model.getProperty_account_expense_categ_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getIncome_currency_exchange_account_id_textDirtyFlag())
            domain.setIncome_currency_exchange_account_id_text(model.getIncome_currency_exchange_account_id_text());
        if(model.getProperty_account_payable_id_textDirtyFlag())
            domain.setProperty_account_payable_id_text(model.getProperty_account_payable_id_text());
        if(model.getProperty_account_income_categ_id_textDirtyFlag())
            domain.setProperty_account_income_categ_id_text(model.getProperty_account_income_categ_id_text());
        if(model.getProperty_stock_valuation_account_id_textDirtyFlag())
            domain.setProperty_stock_valuation_account_id_text(model.getProperty_stock_valuation_account_id_text());
        if(model.getProperty_stock_account_output_categ_id_textDirtyFlag())
            domain.setProperty_stock_account_output_categ_id_text(model.getProperty_stock_account_output_categ_id_text());
        if(model.getProperty_stock_valuation_account_idDirtyFlag())
            domain.setProperty_stock_valuation_account_id(model.getProperty_stock_valuation_account_id());
        if(model.getExpense_currency_exchange_account_idDirtyFlag())
            domain.setExpense_currency_exchange_account_id(model.getExpense_currency_exchange_account_id());
        if(model.getProperty_account_payable_idDirtyFlag())
            domain.setProperty_account_payable_id(model.getProperty_account_payable_id());
        if(model.getProperty_account_income_categ_idDirtyFlag())
            domain.setProperty_account_income_categ_id(model.getProperty_account_income_categ_id());
        if(model.getProperty_stock_account_output_categ_idDirtyFlag())
            domain.setProperty_stock_account_output_categ_id(model.getProperty_stock_account_output_categ_id());
        if(model.getProperty_account_expense_idDirtyFlag())
            domain.setProperty_account_expense_id(model.getProperty_account_expense_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getParent_idDirtyFlag())
            domain.setParent_id(model.getParent_id());
        if(model.getProperty_account_receivable_idDirtyFlag())
            domain.setProperty_account_receivable_id(model.getProperty_account_receivable_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getProperty_account_expense_categ_idDirtyFlag())
            domain.setProperty_account_expense_categ_id(model.getProperty_account_expense_categ_id());
        if(model.getIncome_currency_exchange_account_idDirtyFlag())
            domain.setIncome_currency_exchange_account_id(model.getIncome_currency_exchange_account_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getProperty_stock_account_input_categ_idDirtyFlag())
            domain.setProperty_stock_account_input_categ_id(model.getProperty_stock_account_input_categ_id());
        if(model.getProperty_account_income_idDirtyFlag())
            domain.setProperty_account_income_id(model.getProperty_account_income_id());
        return domain ;
    }


}
